var noteDao = require("../dao/noteDao");

exports.all = function(req, res) {
	noteDao.all(function(err, items) {
		if (err) {
			res.send(err);
			console.log(err);
		} else {
			console.log(items);
		}
	});
};

exports.index = function(req, res){
	res.render('noteadd', { title: 'Document Category'});
};

exports.add = function(req, res) {
	var title = noteDao.DB_COLLECTION_NOTE_COL_TITLE;
	var content = noteDao.DB_COLLECTION_NOTE_COL_CONTENT;
	var categoryid = noteDao.DB_COLLECTION_NOTE_COL_CATEGORY_ID;

	var item = {
		title : req.body.title,
		content : req.body.content
	};

	noteDao.add(item, function(err, item) {
		if (err) {
			res.send(err);
			console.log(err);
		} else {
			console.log(item);
			res.redirect("/");
		}
	});
};